if ( typeof(_goods) == 'undefined')
{
	var _goods = null;
}
function share_sns(type, info) {
	var pic = '';
	var base_url = 'http://www.vipshop.com/';
	var base_pic_url = 'http://sp.vipshop.com/upload/merchandise/';
	var content = encodeURIComponent(info.desc);
	var title = encodeURIComponent(info.title);
	url = encodeURIComponent(base_url + info.url);
	if (info.pic)
	{
		pic = encodeURIComponent((info.pic.indexOf('http')==0)? info.pic : base_pic_url + info.pic);
	}
	if (type != 'tsina' && type != 'kaixin001')
	{
		content += ('  ' + base_url + info.url);
	}
	switch (type)
	{
	case 'tsina':
		window.open('http://v.t.sina.com.cn/share/share.php?title=' + content+'&url='+url+'&appkey=1493335026&pic='+pic,'','width=700, height=580,  toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no');
		break;
	case 'renren':
		window.open('http://share.renren.com/share/buttonshare.do?link='+url);
		break;
	case 'url':
		L_small_div=$("login_div");
		if (!L_small_div)
		{
			L_small_div = document.createElement('div');
			L_small_div.setAttribute('id', 'login_div');
			L_small_div.style.width="738px";
			document.body.appendChild(L_small_div);
		}
		L_small_div.innerHTML = '<img src="/images/btn.gif" style="float:right;margin:5px 8px 0 0;cursor:pointer;" onclick="L_colosediv()" /><div style="padding:10px 0 0px 31px"><p style="font-size:15px;font-weight:bold;">鍙戦€侀摼鎺ュ垎浜細</p><p>鐐瑰嚮鈥滃鍒堕摼鎺モ€濆湪锛岀劧鍚庡埌鑱婂ぉ宸ュ叿閲岀矘璐村嵆鍙€�</p><p>鍟嗗搧鍦板潃锛�<input type="text" value="'+base_url + info.url+'" style="width:400px;border:1px solid #E6DDE4;padding:4px;font-size:12px;color:#7A7A7A;vertical-align:middle;margin-top:10px;*margin-top:0;_margin-top:0" /></p><p><a href="javascript:;" onclick="window.clipboardData.setData(\'Text\',\''+base_url + info.url+'\');alert(\'澶嶅埗鎴愬姛\')" ><img src="/img/shop/fzdz.gif" border="0" style="margin:15px 0 0 61px;*margin:0 0 0 61px;_margin:0 0 0 61px" /></a></p></div>';
		L_small_div.style.height = '170px';
		showlayer();
		break;
	case 'kaixin001':
		window.open('http://www.kaixin001.com/rest/records.php?url='+url+'&content='+content+'&pic='+pic+'&showcount=1&aid=100016274&style=11','','width=700,height=580,toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no');
		break;
        
	case 'douban':
		window.open('http://www.douban.com/recommend/?url='+url+'&title='+title+ '&comment=' + content);
		break;
	case 'qzone':
		window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+url);
		break;
	case 'ttengxin':
		window.open('http://v.t.qq.com/share/share.php?title='+title+'&url='+url,'','width=610,height=350,toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no');
	 
		break;
	case 'sohu':
		window.open('http://t.sohu.com/third/post.jsp?&url=' + url + '&title=' + title + '&content=utf-8&pic=','','width=610,height=350,toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no');
	 
		break;

	case 't163':	
		content = title + ('  ' + base_url + info.url);
		window.open('http://t.163.com/article/user/checkLogin.do?link=' + url + '&source=' + title + '&info=' + content,'','width=750,height=500,toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no');
		break;

	default:
		break;
	
	}
	return false;
}

function share_sns_moreshow() {
    var e = $('share_sns_morelist');
	if (e.style.display != 'block') {
		e.style.display = 'block';
	} 
	else {
		e.style.display = 'none';	
	}    
    return false;
};

function popup_share(text, url) {
	var base_url = 'http://www.vipshop.com/';
	var brand_pic = 'http://216.vipshop.com/upload/brand/';
	var _url = base_url + url;
	var pic = (arguments.length == 3 && arguments[2] != '')? brand_pic + arguments[2] : base_url+ 'images/nav_b0_06.gif';
	_goods = {'desc':text, 'url': url, 'title':'鍒嗕韩鎴戞渶鐖辩殑鍝佺墝', 'pic': pic};
	var _html = '<a href="javascript:;" onclick="L_colosediv()"><img src="/img/account/ksk_03.gif" style="float:right" border="0"/></a>	 <div style="text-align:center;clear:both;margin-bottom:12px;padding:0"><img src="../images/ksk_07.gif" style="vertical-align:middle;margin-right:3px;border:0" /><b>鍒嗕韩鎴戞渶鐖辩殑鍝佺墝锛�</b></div>	 <div style="clear:both;width:570px;padding:10px;margin:0px auto;border:1px solid #e2e0e2;background:#fcfafc;line-height:25px">'+text + _url +'</div>	 <p style="margin:20px 0 0 13px;"><img src="/img/shop/fsghy_tk.gif" onclick="window.clipboardData.setData(\'Text\',\'' + text + _url + '\');alert(\'澶嶅埗鎴愬姛\')" style="vertical-align:middle;margin-left:58px;" /></p>	 <div style="clear:both;margin:23px auto 23px auto;width:576px;height:34px;border:1px solid #E6DEE4; background:#FCF9FB;padding-left:15px"><img src="/img/shop/bppfxgwz.gif" width="141" height="27" style="margin-right:5px;cursor:none"/><img src="/img/shop/fxlj_rrw.gif" style="margin-top:3px;cursor:pointer;padding-left:8px;margin-right:8px;border-left:1px solid #F7EBF3"onclick="share_sns(\'renren\', _goods);" /><img src="/img/shop/fxlj_sina.gif" style="padding-left:8px;margin-right:8px;border-left:1px solid #F7EBF3;cursor:pointer;"onclick="share_sns(\'tsina\', _goods);" /><img src="/img/shop/fxlj_kxw.gif" style="padding-left:8px;margin-right:8px;border-left:1px solid #F7EBF3;cursor:pointer;" onclick="share_sns(\'kaixin001\', _goods);" /><img src="/img/shop/fxlj_db.gif" style="padding-left:8px;margin-right:8px;border-left:1px solid #F7EBF3;cursor:pointer;"onclick="share_sns(\'douban\', _goods);" /><img src="/img/shop/fxlj_qq.gif" style="padding-left:8px;margin-right:8px;border-left:1px solid #F7EBF3;cursor:pointer;" onclick="share_sns(\'qzone\', _goods);" /></div>';
	L_small_div=$("login_div");
	if (!L_small_div)
	{
		L_small_div = document.createElement('div');
		L_small_div.setAttribute('id', 'login_div');
		L_small_div.style.width="738px";
		document.body.appendChild(L_small_div);
	}
	L_small_div.innerHTML = _html;
	L_small_div.style.height = '260px';
	showlayer();
}

(function write_cib_html() {


	var has_cookie = VIPSHOP.cookie.get("cib") || false;
	var tianya_cookie = VIPSHOP.cookie.get("tianya") || false;

		
	if(has_cookie)
	{
		var el = $('div_cib_html') || false;
		var footer = $('div_cib_footer') || false;
		if (!el)
		{
			el = document.createElement('div');
			el.setAttribute('id', 'div_cib_html');
		    $('union_header').insertBefore(el, $('union_header_before')); 
		}
		if (!footer)
		{
			footer = document.createElement('div');
			footer.setAttribute('id', 'div_cib_footer');
			$('footer').appendChild(footer);
		}
		el.innerHTML = "<iframe id=\"jnph\" name=\"jnph\" width=\"100%\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" src=\"http:\/\/www.vipshop.com\/cib\/cib_header.html\" onload=\"javascript:try{this.style.height=(this.contentWindow.document.body.scrollHeight+5)+\'px\'}catch(e){};\"><\/iframe>";
		footer.innerHTML = "<iframe id=\"jnph\" name=\"jnph\" width=\"100%\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" src=\"http:\/\/www.vipshop.com\/cib\/cib_footer.html\" onload=\"javascript:try{this.style.height=(this.contentWindow.document.body.scrollHeight+5)+\'px\'}catch(e){};\"><\/iframe>";
	}else if(tianya_cookie)
	{
		var el = $('div_cib_html') || false;
		var footer = $('div_cib_footer') || false;
		if (!el)
		{
			el = document.createElement('div');
			el.setAttribute('id', 'div_cib_html');
		    $('union_header').insertBefore(el, $('union_header_before')); 
		}
		if (!footer)
		{
			footer = document.createElement('div');
			footer.setAttribute('id', 'div_cib_footer');
			$('footer').appendChild(footer);
		}
		el.innerHTML = "<div style=\"width:1218px;margin:0  auto\" ><div id=\"tyTopNav\" style=\" border:none; margin:0px; padding:0px;\"><iframe src=\" http://qy.tianya.cn/ty_top.jsp?cid=3071&channel=15072\" width=\"100%\" height=\"70px\" frameborder=\"0\" scrolling=\"no\"></iframe></div></div>";
		//footer.innerHTML = "";
	
	}
})();
